package com.exam;

import java.util.ArrayList;
import java.util.List;

public class Switcher {
	private List<Appliance> appliances;
	public Switcher(List<Appliance> appliances){
		this.appliances=new ArrayList<>();
	}
	public void addAppliance(Appliance appliance){
		appliances.add(appliance);
	}
	public void remove(Appliance appliance){
		appliances.remove(appliance);
	}
	
	public void turnOn(){
		for(Appliance appliance:appliances){
			appliance.turnOn();
		}
	}
	public void turnOff(){
		for(Appliance appliance:appliances){
			appliance.turnOff();
		}
	}
}
